function [ pp1,pp2 ] = F( im )
%F Summary of this function goes here
%   Detailed explanation goes here

imageSize=size(im);
% validity test of the input
if (length(imageSize)~=2) %not a 2D image
   error('Input must be a 2D image');
end

if (imageSize(1)~=imageSize(2))
   error('Input image must be square');
end

if (mod(imageSize(1),2)~=0)
   error('Input image must have even side');
end

% initialize constants and data structures
n=imageSize(1);
m=2*n+1;
pp1 = zeros(m,n+1);
pp2 = zeros(m,n+1);

for k=-n:n
    for l=-n/2:n/2
        for u=-n/2:n/2-1
            for v=-n/2:n/2-1
                pp1(k+n+1,l+n/2+1)=pp1(k+n+1,l+n/2+1)+...
                    im(u+n/2+1,v+n/2+1)*exp(-((2*pi*1i*k)/m)*((-2*l/n)*v+u));
                pp2(k+n+1,l+n/2+1)=pp2(k+n+1,l+n/2+1)+...
                    im(u+n/2+1,v+n/2+1)*exp(-((2*pi*1i*k)/m)*((-2*l/n)*u+v));
            end
        end
    end
end

end

